#!/bin/bash

identifierList=("5dc65f37-13c8-4a15-a69b-9a046e30a31d" \
                "e0e41db0-2846-4afd-a244-8d286a84882b" \
                "cf255645-3e1e-4b30-8f32-f39c1859b277" \
                "c01aeb3b-51fd-4851-be8a-39a4bf2fa815" \
                "4f85cb84-2acd-4a8e-b206-58f73f4af4b6" \
                "3f1f6e1b-5b72-4b6c-88e3-4c047f646904" \
                "da677b80-a768-4e8c-baa9-3a4751ec7d54" \
                "8a49e81b-0f88-43b4-8599-fc371da4063a" \
                "70e21d20-cc5e-4d1d-9d2b-7b08f4b061a2" \
                "f55b4dbc-a944-4246-ba12-d6e5110dd8c7" \
                "ac57aa5a-233b-4c2c-bd52-1fb40a31f639")

rm ForEATLAS/EATLASRegistryObjects.xml
    
    for i in ${!identifierList[*]}
    do
        uri="http://e-atlas.org.au/geonetwork/srv/en/oaipmh?verb=GetRecord&identifier=${identifierList[$i]}&metadataPrefix=iso19139.mcp" 
        printf "$uri\n" 

        echo wget --header='Accept-Language: en-us' $uri -O ForEATLAS/${identifierList[$i]}_wget.xml
        wget --header='Accept-Language: en-us' $uri -O ForEATLAS/${identifierList[$i]}_wget.xml
        
        echo "Moving on..."

        echo "java -jar /home/anucsiro/workspace/XML/XSLT/saxon9he.jar ForEATLAS/${identifierList[$i]}_wget.xml /home/anucsiro/workspace/XML/XSLT/ISO19139_To_RIFCS/EATLAS/EATLAS_rif.xsl > ForEATLAS/${identifierList[$i]}_rif-cs.xml"

        java -jar /home/anucsiro/workspace/XML/XSLT/saxon9he.jar ForEATLAS/${identifierList[$i]}_wget.xml /home/anucsiro/workspace/XML/XSLT/ISO19139_To_RIFCS/EATLAS/EATLAS_rif.xsl > ForEATLAS/${identifierList[$i]}_rif-cs.xml

        cat ForEATLAS/${identifierList[$i]}_rif-cs.xml >> ForEATLAS/EATLASRegistryObjects.xml

    done

<<COMMENT
child_identifierList=(  "a0b44257-1652-4f4e-ae46-7a3fe20ef839" \
                        "cbd643be-9358-4a93-9279-7412b6e70b2f" \
                        "615b2600-197e-4c3b-9c46-a88b00729ff7" \
                        "baf18fb4-60e2-44d6-acb3-0583120f5b87" \
                        "028772fc-f6bf-445f-a28e-96a0cfed6eb0" \
                        "cc7435d1-edcb-492a-b511-1934c7131d99" \
                        "180f4bbf-7ffd-4ac1-a838-0aedbb175477" \
                        "5a332a2e-daec-4a09-a797-9482aa5b6c28" \
                        "3ca4e966-f6d6-4d9a-9389-362d1842f137" \
                        "ddd5d5fd-cea5-4436-9886-4895e8ef6f1b" \
                        "36573c3b-ab30-41b9-ad23-cc9eafb4e525" \
                        "15258abc-8583-425b-ae97-85fef558ba3b" \
                        "615b2600-197e-4c3b-9c46-a88b00729ff7" \
                        "e93648ea-4f04-4c74-8501-da7fde21f703" \
                        "8db8172d-c405-4012-97ea-5a7faef7e9c7" \
                        "35dae16b-cbe8-40ee-800e-94ea0e7bff59" \
                        "ac85d9db-1c11-48c9-8ff2-fd5fcc347a74" \
                        "85352b6d-9d9a-4330-9fe5-93b9258a331c" \
                        "727322f6-b34a-4df6-9cb3-61b418e37fd8" \
                        "35446fc0-4af6-11dc-b9a3-00008a07204e" \
                        "727322f6-b34a-4df6-9cb3-61b418e37fd8" \
                        "a5a02dc8-16b4-4b50-abad-af4a1c1e9c49" \
                        "dbd375b2-5422-49a1-a874-0ee8386b9505" \
                        "a581c961-8632-497f-bc5e-2002957577ec")


    
    for i in ${!child_identifierList[*]}
    do
        uri="http://data.EATLAS.gov.au/geonetwork/srv/en/oaipmh?verb=GetRecord&identifier=${child_identifierList[$i]}&metadataPrefix=iso19139.mcp" 
        printf "$uri\n" 

        echo wget --header='Accept-Language: en-us' $uri -O ${child_identifierList[$i]}_wget.xml
        wget --header='Accept-Language: en-us' $uri -O ${child_identifierList[$i]}_wget.xml
        
        echo "Moving on..."

        echo "java -jar /home/anucsiro/workspace/XML/XSLT/saxon9he.jar ${child_identifierList[$i]}_wget.xml /home/anucsiro/workspace/XML/XSLT/ISO19139_To_RIFCS/EATLAS/EATLAS_rif.xsl > ForEATLAS/${child_identifierList[$i]}_rif-cs.xml"

        java -jar /home/anucsiro/workspace/XML/XSLT/saxon9he.jar ${child_identifierList[$i]}_wget.xml /home/anucsiro/workspace/XML/XSLT/ISO19139_To_RIFCS/EATLAS/EATLAS_rif.xsl > ForEATLAS/${child_identifierList[$i]}_rif-cs.xml

        cat ForEATLAS/${child_identifierList[$i]}_rif-cs.xml >> ForEATLAS/EATLASRegistryObjects.xml

    done

COMMENT



   
